package org.karelun.rabbit.rcp.editor;

import org.karelun.ideaboard.gef.requests.CreationFactory;
import org.karelun.rabbit.graph.Connection;
import org.karelun.rabbit.graph.GraphFactory;
import org.karelun.rabbit.graph.Shape;

public class RabbitCreationFactory implements CreationFactory{

	private Class type;
	
	public RabbitCreationFactory(Class aClass){
		this.type=aClass;
	}
	
	@Override
	public Object getNewObject() {
		if(Shape.class.equals(type)){
			return GraphFactory.eINSTANCE.createShape();
		}else if(Connection.class.equals(type)){
			return GraphFactory.eINSTANCE.createConnection();
		}
		return null;
	}

	@Override
	public Object getObjectType() {
		return type;
	}

}
